﻿namespace CatClient.Util
{
    using System;
    using System.IO;
    using System.Net;

    internal class CatHttpRequest
    {
        public static string GetRequest(string url)
        {
            string str;
            try
            {
                HttpWebRequest request1 = (HttpWebRequest) WebRequest.Create(url);
                request1.Timeout = 0x1388;
                request1.Method = "GET";
                request1.Proxy = null;
                request1.Headers[HttpRequestHeader.IfNoneMatch] = Guid.NewGuid().ToString();
                using (WebResponse response = request1.GetResponse())
                {
                    using (Stream stream = response.GetResponseStream())
                    {
                        str = new StreamReader(stream).ReadToEnd();
                    }
                }
            }
            catch
            {
                str = null;
            }
            return str;
        }
    }
}

